﻿using System.Xml;

namespace Pasys.PresentationCore.Utility
{
    public class XmlUtility
    {
        public static string ReadAttribute(XmlNode node, string attributeName)
        {
            return ReadAttribute(node.Attributes, attributeName,string.Empty);
        }

        public static string ReadAttribute(XmlNode node, string attributeName, string defaultValue)
        {
            return ReadAttribute(node.Attributes, attributeName, defaultValue);
        }

        public static string ReadAttribute(XmlAttributeCollection attributes, string attributeName)
        {
            return ReadAttribute(attributes, attributeName, string.Empty);
        }

        public static string ReadAttribute(XmlAttributeCollection attributes, string attributeName, string defaultValue)
        {
            XmlAttribute attr = attributes[attributeName];
            if (attr != null)
            {
                return attr.Value;
            }
            return defaultValue;
        }



    }
}